import React from 'react'
import renderer from 'react-test-renderer'
import {Provider} from 'react-redux'
import configStore from 'redux-mock-store'
import {initialState} from '../redux'

import App from '../src/app'
import {Counter} from '../src/counter'

const snapshotTest = Comp =>
  () =>
    expect(renderer
           .create(
             <Provider store={configStore()(initialState)}>
               <Comp/>
             </Provider>)
           .toJSON())
      .toMatchSnapshot()

describe('App Snapshot', () =>
  test('renders', snapshotTest(App)))

describe('Counter Snapshot', () =>
  test('renders', snapshotTest(Counter)))
